<?php
require_once 'test-00-inc.php';

start('Chaining');

test('CxElementList::items makes it possible to keep chaining:','
    (string)$html->body->select("p")->items[2]["class"]
');

test('CxElement::into() makes it possible to get element
    from the middle of a chain:','
    $html->body->ul->into($test)
        ->set_attribute("class", "LIST")
        ->set_attribute("id", "UL1")
        ->li->set_value("1-st ITEM"),
    $test->source()
');

test('CxElement::import() and CxElement::create() make it possible
    to import existing or create new elements into the current document:','
    $html->body->insert(
        $html->import(new CxElement("<div align=\"right\"><b>IMPORTED</b></div>"))
    )->source(),
    $html->body->append(
        $html->create("<div align=\"left\"><i>CREATED</i></div>")
    )->source()
');

result($html);